{% extends 'course-manage/layout.html.twig' %}

{% block title %}{{'course.plan_base_info'|trans}} - {{ course.title }} - {{ parent() }}{% endblock %}
{% set course_side_nav = 'info' %}
{% do script(['libs/jquery-intro.js', 'libs/es-ckeditor/ckeditor.js', 'libs/jquery-validation.js', 'libs/bootstrap-datetimepicker.js', 'libs/select2.js', 'libs/perfect-scrollbar.js', 'app/js/course-manage/info/index.js']) %}

{% block page_title %}{{ 'course.plan_base_info'|trans }}{% endblock %}
{% block paddingClass %}course-manage-body course-manage-info js-course-manage-info{% endblock %}
{% block main_heading_class %} course-manage-info__title {% endblock %}

{% block main_body %}
  {% set hasMulCourses = has_mul_courses(courseSet.id) %}
  <input type="hidden" id="s2b2c_enabled" value="{{ is_s2b2c_enabled() }}">
  {#添加admin_v2#}
  {% if 'ROLE_SUPER_ADMIN' in app.user.roles or 'ROLE_ADMIN' in app.user.roles or ('ROLE_TEACHER' in app.user.roles and setting('course.teacher_manage_marketing', 0) == 1) or has_permission('admin_course_content_manage') or has_permission('admin_v2_course_content_manage')%}
    <form class="form-horizontal" role="form" id="course-info-form" action="{{path('course_set_manage_course_info', {courseSetId: courseSet.id, courseId: course.id})}}" method="post">
      {# 课程基础信息 #}
      {% if is_un_multi_courseset(courseSet.id) %}
        <div class="course-manage-subltitle cd-mb40">{{ 'course.base_info'|trans }}</div>
        {% include 'courseset-manage/base-info/info.html.twig' with {form: 'course-info-form', button:'course-submit'} %}
      {% endif %}

      {# 计划基础信息 #}
      {% if hasMulCourses %}
        <div class="course-manage-subltitle cd-mb40">{{ 'course.base_info'|trans }}</div>
        {% include 'course-manage/base-info/title.html.twig' %}
      {% endif %}
      
      {# 营销设置 #}
      <div class="course-manage-subltitle cd-mb40">{{ 'course.marketing_setup'|trans }}</div>
      <div role="course-marketing-info">
        {% include 'course-manage/base-info/marketing.html.twig' %}
      </div>

      {# 基础规则 #}
      <div class="course-manage-subltitle cd-mb40">{{ 'course.base_setup.rules'|trans }}</div>
      <div role="course-base-rule">
        {% include 'course-manage/base-info/rule.html.twig' %}
      </div>
      
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-8">
          <button id="course-submit" type="button" class="cd-btn cd-btn-primary" data-loading-text="{{ 'form.btn.save.submiting'|trans }}">{{ 'form.btn.save'|trans }}</button>
          <div id="test"></div>
        </div>
      </div>

      {% if not hasMulCourses and courseSet.type == 'normal' %}
        <div class="course-manage-intro js-plan-intro hidden">
          <div class="course-manage-intro__outer js-plan-intro-btn">
            <div class="course-manage-intro__inner"><i class="es-icon es-icon-zhinan"></i></div>
          </div>
          <div class="mtm course-manage-intro__tip">{{ 'course.base_plan_intro'|trans }}</div>
        </div>
      {% endif %}
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% else %}
    <div class="cd-alert cd-alert-danger">{{ 'course.marketing_setup.no_permission_tips'|trans }}</div>
  {% endif %}
{% endblock %}
